import axios from 'axios'

const http = axios.create({
    baseURL: process.env.VUE_APP_API_URL || '/admin/api/'
})

http.interceptors.request.use(config => {
    const token = localStorage.getItem('token') || '';
    token && (config.headers['token'] = token)
    return config
}, error => {
    // switch(error.response.status){
    //     case ""
    // }
    console.log(error.response)
    Promise.reject(err)
})

http.interceptors.response.use(resp => {
    return resp
})


export default http;